log using "~/Replication/BDE2021_replication", text replace

/*------------------------------------------------------------------------------

          "UN peacekeeping and households’ well-being in civil wars"
									by
			Vincenzo Bove, Jessica Di Salvatore and Leandro Elia

								01/02/2020

------------------------------------------------------------------------------*/


* this is the working directory
cd "~/Replication"

* Please copy all ancillary dofiles included in the replication package in the same directory as above

use Replication_data, clear

* install ado "reghdfe" 

ssc install reghdfe, replace

*  Assign outcome variables to global macro

global outcome "pcqcons hunger pcqpurc pcwealthdg"

*  Assign control variables to global macros

global micro "married hhsize women age1 primary secondary rural mig christian Dinka"
global macro "c.agri_ih2010#i.wave_number c.pasture_ih2010#i.wave_number"

*  Assign mediator variables to global macros

global mediators "safe2 noincreasevio employed market_time livcondfut lifesat "


/*------------------------------------------------------------------------------

	Table 1. PK impact on household consumption (outcome)

------------------------------------------------------------------------------*/


foreach outcome of global outcome {
	reghdfe `outcome' pkoarmed  $micro $macro, /*
	*/ absorb(cty wave_number) vce(cluster i.idhh)
	}

/*------------------------------------------------------------------------------

	Table 2. PK impact on mediators:
									a) security environment 
									a1) economic transactions 
									a2) psycological wellbeing

------------------------------------------------------------------------------*/


foreach m of global mediators {
	reghdfe `m' pkoarmed  $micro $macro , /*
		*/ absorb(cty wave_number) vce(cluster i.idhh)
	}


/*------------------------------------------------------------------------------

	Table 3. Calculation of indirect effects 	
	
------------------------------------------------------------------------------*/


do "~/Replication_IndEffects.do"


/*------------------------------------------------------------------------------

	Tables for the online appendix 
	
------------------------------------------------------------------------------*/


do "~/Replication_Appendix.do"


log close
